/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package EmpMonthlySal;

import SalaryComponent.EmpSalDetailsBean;
import SalaryComponent.EmpSalaryBean;
import SalaryComponent.SalaryComponentBean;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.Vector;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Mukesh
 */
public class GetMonthSalDetail extends HttpServlet {
   
  
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        
        try {
            int EmpId=Integer.parseInt(request.getParameter("empid"));
            
            Vector list=EmpMonthlySal.Query.getMonthSalDetail(EmpId);
            Iterator it=list.iterator();
            while(it.hasNext())
            {
             EmpSalaryBean esb = (EmpSalaryBean)it.next();
             EmpSalDetailsBean esdb = esb.getEmpSalDetailsBean();
             SalaryComponentBean ecb = esb.getSalaryComponentBean();
             out.println(ecb.getSalaryComponent()+" : "+esdb.getAmount());
            }
            }catch(Exception e){
            out.println(e);
            } finally {
            out.close();
        }
    } 

    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    } 

    
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    }

    
    @Override
    public String getServletInfo() {
        return "Short description";
    }// </editor-fold>

}
